<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- #include file="inc/conn.inc" -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>删除图片</title>
<%
	function getFileList(strSQL, strPic)
		set rs = server.createobject("adodb.recordset")
	  rs.open strSQL,dbconnection,3,3
		do while not rs.eof
			if rs(strPic) <> "" then
				ReDim Preserve ResultArray(index)
				ResultArray(index) = cstr(rs(strPic))
				index = index + 1
			end if
			rs.MoveNext
		loop
		set rs = nothing
	end function

	Dim ResultArray()
	index = 0
	getFileList "select Pic from GameClub", "Pic"
	getFileList "select Pic from GameWiki", "Pic"
	getFileList "select Pic from Advertisement", "Pic"
	getFileList "select Pic from Discount", "Pic"
	getFileList "select Pic from frank", "Pic"
	getFileList "select Pic from goods", "Pic"
	getFileList "select Pic from pd", "Pic"
	getFileList "select Pic from Ad", "Pic"
	PicPath = Server.MapPath("/uploadpic")
	PicPathBak = PicPath + ".bak"
	set fso = server.CreateObject("scripting.filesystemobject")
	fso.CreateFolder PicPathBak
	for each f in ResultArray
		fileFullName =  Server.MapPath("/" + f)
		if fso.FileExists(fileFullName) = true then
			fileNames = split(fileFullName, "\")
			fileName = fileNames(ubound(fileNames))
			fso.CopyFile fileFullName, PicPathBak + "\" + fileName
		end if
	next
	
	fso.DeleteFolder PicPath
	fso.MoveFolder PicPathBak, PicPath
	set fso = nothing
%>
</head>

<body>
删除图片完成
</body>
</html>
